package com.ljtxxhwj.myblob.controller;

import com.ljtxxhwj.myblob.util.CaptchaUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@RestController
public class CaptchaController {

    @GetMapping("/captcha.do")
    public void getCaptcha(HttpSession session, HttpServletResponse response) {
        String captcha = CaptchaUtils.createCaptchaImage(response);
        session.setAttribute("captcha", captcha);
        return;
    }
}
